# 创建复数 3+4j
complex_number = 3 + 4j

# 打印整个复数
print("复数:", complex_number)  # 输出: (3+4j)

# 访问并打印实部
real_part = complex_number.real
print("实部:", real_part)  # 输出: 3.0

# 访问并打印虚部
imaginary_part = complex_number.imag
print("虚部:", imaginary_part)  # 输出: 4.0